/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package restauranteaplicacion.Modificaciones;

import Clases.Observador;
import javax.swing.JTextField;
import entidad.Producto;
import CapaNegocios.CNProducto;
import CapaNegocios.CNUnidadMedida;
import entidad.DetalleDePlato;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import entidad.Unidaddemedida;
import entidad.Clasificacion;
import CapaNegocios.CNClasificacion;
import CapaNegocios.CNPlatos;
import Clases.ComboBox;
import controlrestaurante.pmf;
import java.awt.Component;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.TableModel;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporter;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
import org.jdesktop.beansbinding.Bindings;
import restauranteaplicacion.Ingresos.IngresoProducto;
import restauranteaplicacion.MDI;

/**
 *
 * @author Victor
 */
public class ModificacionProducto extends javax.swing.JInternalFrame implements Observer{

    /**
     * Creates new form IngresoEmpleado
     */
    Observador obs;
    //DefaultTableModel modelo;
    List<DetalleDePlato> listaDetalle;
    TableModel mo;
    List<Producto> lista;
    @SuppressWarnings("empty-statement")
    public ModificacionProducto() {
        initComponents();
        obs=new Observador();
        obs.addObserver(this);
        
        //modelo = (DefaultTableModel) Tabla.getModel();
        listaDetalle = new ArrayList<>();
        //productoList = CNProducto.buscarNombre(txtNombrePlato.getText());//CNProducto.buscarTodos();
        producto2 = new Producto();
        /*lista = CNProducto.buscarTodos();        
        String [] col= new String[]{"Nombre","Cantidad","Cantidad Minima","Precio"};
        Object[][] hola = new Object [lista.size()][4];
        int c =0;
        for(Producto x : lista)
        {
            hola[c][0]=  x.getNombre();
            hola[c][1]=x.getCanitdad();
            hola[c][2]=x.getMinimaExistencias();
            hola[c][3]=x.getPrecio();
            c++;
        }
        mo=new Clases.TableModel(col, lista, hola);
        Tabla.setModel(mo);
        Tabla.setDefaultRenderer(String.class, new TextArea());*/
    }
    


    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        productoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(controlrestaurante.pmf.getInstancia().getEMF().createEntityManager().createNamedQuery("Producto.findAll").getResultList());
        producto2 = new entidad.Producto();
        jPanel1 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabel20 = new javax.swing.JLabel();
        txtNombrePlato = new javax.swing.JTextField();
        btnModificar = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();
        btnAgregar = new javax.swing.JButton();
        btnAgregar1 = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        jLayeredPane3 = new javax.swing.JLayeredPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        Tabla = new javax.swing.JTable();
        btnCancelar = new javax.swing.JButton();
        btnCancelar1 = new javax.swing.JButton();

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.idProducto}"), producto2, org.jdesktop.beansbinding.BeanProperty.create("idProducto"), "");
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, Tabla, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.nombre}"), producto2, org.jdesktop.beansbinding.BeanProperty.create("nombre"));
        bindingGroup.addBinding(binding);

        setBackground(new java.awt.Color(255, 255, 255));
        setClosable(true);
        setIconifiable(true);
        setTitle("Creacion Meseros");
        setAutoscrolls(true);
        setMaximumSize(new java.awt.Dimension(984, 649));
        setMinimumSize(new java.awt.Dimension(984, 649));
        setPreferredSize(new java.awt.Dimension(984, 649));
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.PAGE_AXIS));

        jPanel1.setBackground(new java.awt.Color(54, 149, 240));
        jPanel1.setMaximumSize(new java.awt.Dimension(2000, 50));
        jPanel1.setMinimumSize(new java.awt.Dimension(246, 50));
        jPanel1.setPreferredSize(new java.awt.Dimension(1000, 50));

        jLabel4.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Productos");
        jPanel1.add(jLabel4);

        getContentPane().add(jPanel1);

        jPanel4.setPreferredSize(new java.awt.Dimension(988, 430));

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setPreferredSize(new java.awt.Dimension(494, 500));

        jLabel19.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel19.setText("BUSCAR PRODUCTOS");

        jLayeredPane1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jLabel20.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel20.setText("<html>Buscar por nombre o Codigo\n</html>");
        jLabel20.setBounds(10, 20, 100, 40);
        jLayeredPane1.add(jLabel20, javax.swing.JLayeredPane.DEFAULT_LAYER);

        txtNombrePlato.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        txtNombrePlato.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtNombrePlatoKeyTyped(evt);
            }
        });
        txtNombrePlato.setBounds(120, 20, 390, 30);
        jLayeredPane1.add(txtNombrePlato, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/pencil-3x.png"))); // NOI18N
        btnModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarActionPerformed(evt);
            }
        });
        btnModificar.setBounds(770, 20, 50, 40);
        jLayeredPane1.add(btnModificar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restauranteaplicacion/Ingresos/x-3x.png"))); // NOI18N
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });
        btnEliminar.setBounds(840, 20, 50, 40);
        jLayeredPane1.add(btnEliminar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/plus-3x.png"))); // NOI18N
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });
        btnAgregar.setBounds(700, 20, 50, 40);
        jLayeredPane1.add(btnAgregar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnAgregar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/reload-3x.png"))); // NOI18N
        btnAgregar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregar1ActionPerformed(evt);
            }
        });
        btnAgregar1.setBounds(520, 20, 50, 40);
        jLayeredPane1.add(btnAgregar1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel21.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel21.setText("PRODUCTO");

        jLayeredPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        Tabla.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, productoList, Tabla);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nombre}"));
        columnBinding.setColumnName("Nombre");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${precio}"));
        columnBinding.setColumnName("Precio");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${canitdad}"));
        columnBinding.setColumnName("Cantidad");
        columnBinding.setColumnClass(Float.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${descripcion}"));
        columnBinding.setColumnName("Descripcion");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${presentacion}"));
        columnBinding.setColumnName("Presentacion");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${unidadDeMedidaidUnidadDeMedida.nombre}"));
        columnBinding.setColumnName("Unidad de Medicion");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${minimaExistencias}"));
        columnBinding.setColumnName("Cantidad Minima");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        Tabla.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaMouseClicked(evt);
            }
        });
        Tabla.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                TablaKeyReleased(evt);
            }
        });
        jScrollPane2.setViewportView(Tabla);

        jScrollPane2.setBounds(10, 20, 840, 250);
        jLayeredPane3.add(jScrollPane2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnCancelar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/circle-x-3x.png"))); // NOI18N
        btnCancelar.setText("Salir");
        btnCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });
        btnCancelar.setBounds(10, 290, 93, 53);
        jLayeredPane3.add(btnCancelar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        btnCancelar1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        btnCancelar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/circle-x-3x.png"))); // NOI18N
        btnCancelar1.setText("Imprimir");
        btnCancelar1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCancelar1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCancelar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelar1ActionPerformed(evt);
            }
        });
        btnCancelar1.setBounds(730, 290, 93, 53);
        jLayeredPane3.add(btnCancelar1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel21)
                    .addComponent(jLabel19)
                    .addComponent(jLayeredPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 902, Short.MAX_VALUE)
                    .addComponent(jLayeredPane1))
                .addContainerGap(42, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel21)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLayeredPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 357, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(50, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 968, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 569, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel4);

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

  
    
    private void CargarTabla(List<Producto> listatemp){
        productoList.clear();
        agregarLista(productoList,listatemp);
    }
    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
        
        this.setVisible(false);
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        // TODO add your handling code here:
        int fila =0;
        if(Tabla.getSelectedRow()>=0)
        {
            fila = JOptionPane.showInternalConfirmDialog(this, "Desea Eliminar "
                + " el producto", "Confirmacion",1, 0);
            if(fila == JOptionPane.OK_OPTION)
            {
                //eliminar el producto
                if(CNProducto.eliminar(producto2))
                {
                    productoList.remove(producto2);
                    JOptionPane.showMessageDialog(this, "Se elimino Correctamente", 
                        "Informacion", JOptionPane.INFORMATION_MESSAGE);
                }
                else
                    JOptionPane.showMessageDialog(this, "No se ha podido Eliminar", 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
            }
        }
        else
            JOptionPane.showMessageDialog(this, "Debe de Seleccionar un elemento", 
                    "Informacion", JOptionPane.INFORMATION_MESSAGE);
       
    }//GEN-LAST:event_btnEliminarActionPerformed
boolean comboProducto;
  
    
    private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed
        //TODO add your handling code here:  
       if(Tabla.getSelectedRow()>= 0)
       {
           IngresoProducto ing = new IngresoProducto(obs, producto2);
           MDI.getDesktopPane().add(ing);
           ing.show();
           obs.addObserver(ing);
           Desactivar();
           
       }
        
    }//GEN-LAST:event_btnModificarActionPerformed

    private void txtNombrePlatoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNombrePlatoKeyTyped
        // TODO add your handling code here:
        if(txtNombrePlato.getText().length() >=2)
        {    
            CargarTabla(CNProducto.buscarNombre(txtNombrePlato.getText()));
        }
        if(txtNombrePlato.getText().length() ==1)
            CargarTabla(CNProducto.buscarTodos());
    }//GEN-LAST:event_txtNombrePlatoKeyTyped

    private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
        // TODO add your handling code here:
        IngresoProducto ing = new IngresoProducto(obs);
        MDI.getDesktopPane().add(ing);
        ing.show();
        obs.addObserver(ing);
        Desactivar();
    }//GEN-LAST:event_btnAgregarActionPerformed

    private void TablaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaMouseClicked
        // TODO add your handling code here:
        int fila = Tabla.rowAtPoint(evt.getPoint());
        producto2 =productoList.get(fila);
    }//GEN-LAST:event_TablaMouseClicked

    private void TablaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TablaKeyReleased
        // TODO add your handling code here:
        if (evt.getKeyCode() == 38 || evt.getKeyCode()== 40)
        {
            int fila = Tabla.getSelectedRow();
            producto2 =productoList.get(fila);
        }
    }//GEN-LAST:event_TablaKeyReleased

    private void btnAgregar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregar1ActionPerformed
        // TODO add your handling code here:
        txtNombrePlato.setText("");
        buscarTodos();
    }//GEN-LAST:event_btnAgregar1ActionPerformed

    private void btnCancelar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelar1ActionPerformed
        // TODO add your handling code here:
        JRBeanCollectionDataSource jbean = new JRBeanCollectionDataSource(productoList);     
        try {
            //JasperReport js= (JasperReport) JRLoader.loadObject("report1.jasper");
            URL hi =getClass().getResource("/Reportes/reporteProducto.jasper");
            JasperReport report  = (JasperReport)JRLoader.loadObject(hi);
            JasperPrint jaserPrint = JasperFillManager.fillReport(report, null,jbean);
            JasperViewer jviewer = new JasperViewer(jaserPrint,false);
            //Le damos un título al reporte.
            jviewer.setTitle("Lista de Tipos de Artículos.");
            //La hacemos visible.
            jviewer.setVisible(true);
            //JRExporter exporter = new JRPdfExporter();  
            //exporter.setParameter(JRExporterParameter.JASPER_PRINT, jaserPrint); 
            //exporter.setParameter(JRExporterParameter.OUTPUT_FILE, new java.io.File("reporte2PDF.pdf")); 
            //exporter.exportReport();
        } catch (JRException ex) {
            
            System.out.println(ex.toString());
            //Logger.getLogger(ModificacionProducto.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
        }
    }//GEN-LAST:event_btnCancelar1ActionPerformed

    private void buscarTodos()
    {
        CargarTabla(CNProducto.buscarTodos());
    }
    
    public void agregarLista(List<Producto>lista, List<Producto> nuevaLista)
    {
        Iterator<Producto> ite = nuevaLista.iterator();
        while(ite.hasNext())
        {
            Producto temp = ite.next();
            lista.add(temp);

        }
        
    }
    
    private void Desactivar()
    {
        for(Component x :this.jPanel2.getComponents())
            x.setEnabled(false);
        for(Component x : this.jLayeredPane1.getComponents())
            x.setEnabled(false);
        for(Component x : this.jLayeredPane3.getComponents())
            x.setEnabled(false);
    }
    private void Activar()
    {
        for(Component x :this.jPanel2.getComponents())
            x.setEnabled(true);
        for(Component x : this.jLayeredPane1.getComponents())
            x.setEnabled(true);
        for(Component x : this.jLayeredPane3.getComponents())
            x.setEnabled(true);
        
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable Tabla;
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnAgregar1;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnCancelar1;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnModificar;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane2;
    public static entidad.Producto producto2;
    private java.util.List<entidad.Producto> productoList;
    private javax.swing.JTextField txtNombrePlato;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    @Override
    public void update(Observable o, Object arg) {
       Activar();
       CargarTabla(CNProducto.buscarNombre(txtNombrePlato.getText()));
       
    }
}
